<html>
<head><meta charset="utf-8"><title>and_then with Boxed trait object(miri PR #1495) · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/and_then.20with.20Boxed.20trait.20object(miri.20PR.20.231495).html">and_then with Boxed trait object(miri PR #1495)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205736190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/and_then%20with%20Boxed%20trait%20object%28miri%20PR%20%231495%29/near/205736190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Samrat Man Singh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/and_then.20with.20Boxed.20trait.20object(miri.20PR.20.231495).html#205736190">(Aug 02 2020 at 17:29)</a>:</h4>
<p>Hi, I'm trying to make changes to address this comment by <span class="user-mention" data-user-id="124288">@oli</span> : <a href="https://github.com/rust-lang/miri/pull/1495/files#r464038285">https://github.com/rust-lang/miri/pull/1495/files#r464038285</a> </p>
<p>When I try to pass the returned <code>Box&lt;dyn FileDescriptor&gt;</code> to the <code>as_file_handle</code> method, I get this error: </p>
<div class="codehilite"><pre><span></span><code>expected signature of `fn(std::boxed::Box&lt;dyn shims::posix::fs::FileDescriptor&lt;&#39;tcx&gt;&gt;) -&gt; _`
</code></pre></div>


<p>Is my understanding correct that this is due to the compiler not finding the impl for the Boxed trait object? Any ideas on how I could resolve this?</p>
<p>Here is what I have changed: <a href="https://github.com/samrat/miri/commit/054420ffc428e53e6a233b1f5ee73ad0b2bfa59a#diff-560909e2fdd6fac0fb0b832d9470ac7cR460">https://github.com/samrat/miri/commit/054420ffc428e53e6a233b1f5ee73ad0b2bfa59a#diff-560909e2fdd6fac0fb0b832d9470ac7cR460</a></p>



<a name="205736448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/and_then%20with%20Boxed%20trait%20object%28miri%20PR%20%231495%29/near/205736448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/and_then.20with.20Boxed.20trait.20object(miri.20PR.20.231495).html#205736448">(Aug 02 2020 at 17:35)</a>:</h4>
<p>hmm... that's because the function takes <code>&amp;self</code>. I guess you can <code>.get(..).as_ref().map(FileDescriptor::as_file_handle)</code> but that's a mouth full</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>